package com.mypackage.diary.model;

// Generated Nov 7, 2014 12:02:55 AM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Userprofile generated by hbm2java
 */
@Entity
@Table(name = "userprofile", catalog = "diary", uniqueConstraints = @UniqueConstraint(columnNames = "Email"))
public class Userprofile implements java.io.Serializable {

	private Integer id;
	private Authority authority;
	private String username;
	private String password;
	private String email;
	private Boolean enabled;
	private Set<Diary> diaries = new HashSet<Diary>(0);
	private Set<Userprofile> userprofilesForFriendId = new HashSet<Userprofile>(
			0);
	private Set<Userprofile> userprofilesForUserId = new HashSet<Userprofile>(0);
	private Set<Comment> comments = new HashSet<Comment>(0);
	private Set<Friendrequest> friendrequestsForReceiverId = new HashSet<Friendrequest>(
			0);
	private Set<Diarypermission> diarypermissions = new HashSet<Diarypermission>(
			0);
	private Set<Friendrequest> friendrequestsForSenderId = new HashSet<Friendrequest>(
			0);
	private Set<Category> categories = new HashSet<Category>(0);

	public Userprofile() {
	}

	public Userprofile(Authority authority, String username, String password,
			String email) {
		this.authority = authority;
		this.username = username;
		this.password = password;
		this.email = email;
	}

	public Userprofile(Authority authority, String username, String password,
			String email, Boolean enabled, Set<Diary> diaries,
			Set<Userprofile> userprofilesForFriendId,
			Set<Userprofile> userprofilesForUserId, Set<Comment> comments,
			Set<Friendrequest> friendrequestsForReceiverId,
			Set<Diarypermission> diarypermissions,
			Set<Friendrequest> friendrequestsForSenderId,
			Set<Category> categories) {
		this.authority = authority;
		this.username = username;
		this.password = password;
		this.email = email;
		this.enabled = enabled;
		this.diaries = diaries;
		this.userprofilesForFriendId = userprofilesForFriendId;
		this.userprofilesForUserId = userprofilesForUserId;
		this.comments = comments;
		this.friendrequestsForReceiverId = friendrequestsForReceiverId;
		this.diarypermissions = diarypermissions;
		this.friendrequestsForSenderId = friendrequestsForSenderId;
		this.categories = categories;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "IdRole", nullable = false)
	public Authority getAuthority() {
		return this.authority;
	}

	public void setAuthority(Authority authority) {
		this.authority = authority;
	}

	@Column(name = "Username", nullable = false, length = 100)
	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name = "Password", nullable = false, length = 100)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "Email", unique = true, nullable = false)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "Enabled")
	public Boolean getEnabled() {
		return this.enabled;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofile")
	public Set<Diary> getDiaries() {
		return this.diaries;
	}

	public void setDiaries(Set<Diary> diaries) {
		this.diaries = diaries;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "friend", catalog = "diary", joinColumns = { @JoinColumn(name = "UserId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "FriendId", nullable = false, updatable = false) })
	public Set<Userprofile> getUserprofilesForFriendId() {
		return this.userprofilesForFriendId;
	}

	public void setUserprofilesForFriendId(
			Set<Userprofile> userprofilesForFriendId) {
		this.userprofilesForFriendId = userprofilesForFriendId;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "friend", catalog = "diary", joinColumns = { @JoinColumn(name = "FriendId", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "UserId", nullable = false, updatable = false) })
	public Set<Userprofile> getUserprofilesForUserId() {
		return this.userprofilesForUserId;
	}

	public void setUserprofilesForUserId(Set<Userprofile> userprofilesForUserId) {
		this.userprofilesForUserId = userprofilesForUserId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofile")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofileByReceiverId")
	public Set<Friendrequest> getFriendrequestsForReceiverId() {
		return this.friendrequestsForReceiverId;
	}

	public void setFriendrequestsForReceiverId(
			Set<Friendrequest> friendrequestsForReceiverId) {
		this.friendrequestsForReceiverId = friendrequestsForReceiverId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofile")
	public Set<Diarypermission> getDiarypermissions() {
		return this.diarypermissions;
	}

	public void setDiarypermissions(Set<Diarypermission> diarypermissions) {
		this.diarypermissions = diarypermissions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofileBySenderId")
	public Set<Friendrequest> getFriendrequestsForSenderId() {
		return this.friendrequestsForSenderId;
	}

	public void setFriendrequestsForSenderId(
			Set<Friendrequest> friendrequestsForSenderId) {
		this.friendrequestsForSenderId = friendrequestsForSenderId;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userprofile")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

}
